<template>
  <div class="cash-out-details table-theme">
    <head-title title="合作--提现明细"></head-title>
    <el-card>
      <div class="top-menu">
        <div class="menu-right">
          <refresh-button @refresh="refreshPage"></refresh-button>
          <search-view
            :option="searchOption"
            @value="goSearch"
            @clear="refreshPage"
          ></search-view>
        </div>
      </div>

      <p class="data-number">总数据数：{{ total }}</p>
      <el-table :data="recordList" border class="factory-table">
        <el-table-column
          label="提现ID"
          align="center"
          prop="take_id"
        ></el-table-column>
        <el-table-column
          label="用户ID"
          align="center"
          prop="user_id"
        ></el-table-column>
        <el-table-column
          label="申请人"
          align="center"
          prop="real_name"
        ></el-table-column>
        <el-table-column
          label="支付宝"
          align="center"
          prop="alipay_sn"
        ></el-table-column>
        <el-table-column
          label="提现金额"
          align="center"
          prop="money"
        ></el-table-column>
        <el-table-column
          label="提现端"
          align="center"
          prop="pay_client_name"
        ></el-table-column>
        <el-table-column
          label="提现时间"
          align="center"
          prop="add_time"
        ></el-table-column>
        <el-table-column
          label="提现IP"
          align="center"
          prop="ip_address"
        ></el-table-column>
        <el-table-column
          label="状态"
          align="center"
          prop="status_name"
        ></el-table-column>
      </el-table>
      <div class="pages">
        <el-pagination
          background
          layout="prev, pager, next, jumper"
          :total="total"
          @current-change="init"
          :current-page="page"
        ></el-pagination>
      </div>
    </el-card>
  </div>
</template>

<script>
export default {
  data() {
    return {
      searchContent: "",
      recordList: [],
      total: 0,
      totalData: 0,
      page: 0,
      searchOption: [
        {
          value: 0,
          label: "姓名",
        },
      ],
      classSelect: 0,
      selectContent: "",
    };
  },
  methods: {
    // 初始化列表
    init(e) {
      this.page = e;
      let data = {
        page: e - 1 ? e - 1 : 0,
        limit: 10,
      };
      if (this.classSelect == 0 && this.selectContent != "") {
        data.real_name = this.selectContent;
      }
      this.$http(this.$ApiList.WithdrawalLog, data).then((res) => {
        let pay_client = ["", "小程序", "APP", "h5", "后台"];
        this.recordList = [];
        res.datas.data.forEach((item) => {
          item.pay_client_name = pay_client[item.pay_client];
          this.recordList.push(item);
        });
        this.total = res.datas.count;
      });
    },
    goSearch(classSelect, selectContent) {
      this.classSelect = classSelect;
      this.selectContent = selectContent;
      this.init();
    },
    refreshPage() {
      this.selectContent = "";
      this.page = 1;
      this.init();
    },
  },
  created() {
    this.init();
  },
};
</script>
<style lang="scss" scoped>
.menu-right {
  flex: 1;
}
</style>
